package com.example.mardan_demo1.pojo;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import lombok.Data;
import lombok.NonNull;

import java.time.LocalDateTime;

//实体类
//lombok 在编译阶段自动为实体类生成setter getter toString
//pom 文件中引入依赖，在实体类上填写注解
@Data
public class User {

    private Integer id;

    private String name;  // 昵称
    private Short age; // 年龄
    private Short gender;  // 性别

    private String phone; // 联系电话

    private String password;  // 密码
    private String status; // 状态
    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;

    private String username;  // 登录名称
    private String email; // 邮箱
    private String userAvatar;  // 头像
    private String dan_wei_ming_cheng; //单位名称-委托单位名称
    private String dan_wei_di_zhi; // 单位地址 - 委托单位地址
    // 委托单位联系人是账号拥有者
    private String dan_wei_chuan_zhen ; //单位传真-委托单位传真

    private String role; // 用户权限， customer、management、admin

    private String bumen; // 用户所述部门
    // 无参数构造函数
    public User() {
    }
    // 带参数的构造函数
    @JsonCreator
    public User(
            @JsonProperty("id") Integer id,
            @JsonProperty("name") String name,
            @JsonProperty("age") Short age,
            @JsonProperty("gender") Short gender,
            @JsonProperty("phone") String phone,
            @JsonProperty("password") String password,
            @JsonProperty("status") String status,
            @JsonProperty("createdAt") LocalDateTime createdAt,
            @JsonProperty("updatedAt") LocalDateTime updatedAt,
            @JsonProperty("username") String username,
            @JsonProperty("email") String email,
            @JsonProperty("userAvatar") String userAvatar,
            @JsonProperty("dan_wei_ming_cheng") String dan_wei_ming_cheng
    ) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.gender = gender;
        this.phone = phone;
        this.password = password;
        this.status = status;
        this.createdAt = createdAt;
        this.updatedAt = updatedAt;
        this.username = username;
        this.email = email;
        this.userAvatar = userAvatar;
        this.dan_wei_ming_cheng = dan_wei_ming_cheng;
    }
}
